#include <stdio.h>

int main()
{
	int N = 0, i = 0, j = 1, num = 0, size = 0;
	int data[1000] = {0};
	//用于存储A1 A2 A3 A4 A5
	int output[5] = {0};
	while(1){
		if(i == 0){
			scanf("%d", &N);
			i++;
		}
		scanf("%d", &data[size++]);
		if(size >= N){
			break;
		}
	}	

	for(i = 0; i < N; i++){
		//能被5整除，并且是偶数
		if(data[i] % 5 == 0 && data[i] % 2 == 0){
			output[0] += data[i];
		}	
		//被5除余1
		if(data[i] % 5 == 1){
			if(j % 2 == 0){
				output[1] -= data[i];
			}
			else{
				output[1] += data[i];
			}
			j++;
		}
		//被5除余2  的个数
		if(data[i] % 5 == 2){
			output[2]++;
		}
		//被5除余3的数
		if(data[i] % 5 == 3){
			output[3] += data[i];
			num++;
		}
		//被5除余4的最大数
		if(data[i] % 5 == 4){
			if(output[4] < data[i]){
				output[4] = data[i];
			}
		}
	}
	//输出
	for(i = 0; i < 5; i++){
		if(output[i] == 0){
			printf("%s%s", (i==0?"":" ") ,"N");
		}
		else if(i == 3){
			printf(" %.1f", (float)output[i] / num);
		}
		else{
			printf("%s%d", (i==0?"":" ") ,output[i]);
		}
	}
	printf("\n");
	return 0;
}
